package com.xjc.controller.response;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.flowable.engine.repository.Model;

import java.io.Serial;
import java.io.Serializable;

/**
 * <p>
 * flowable模型
 * </p>
 *
 * @author xiaojincai
 * @since 2025-07-11
 */
@Data
@Schema(description = "ModelVO")
public class ModelVO implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @Schema(description = "id")
    private String id;

    /**
     * 模型名称
     */
    @Schema(description = "模型名称")
    private String modelName;

    /**
     * 模型标识
     */
    @Schema(description = "模型标识")
    private String modelKey;

    /**
     * 模型版本
     */
    @Schema(description = "模型版本")
    private Integer modelVersion;

    /**
     * 模型分类
     */
    @Schema(description = "模型分类")
    private String modelCategory;

    @JsonIgnore
    @Schema(hidden = true)
    public static ModelVO build(Model model){
        if (model == null) {
            return null;
        }

        final ModelVO modelVO = new ModelVO();
        modelVO.setId(model.getId());
        modelVO.setModelName(model.getName());
        modelVO.setModelKey(model.getKey());
        modelVO.setModelVersion(model.getVersion());
        modelVO.setModelCategory(model.getCategory());
        return modelVO;
    }
}